package exp.ranking.fe;

import cc.mallet.pipe.Pipe;
import cc.mallet.types.Instance;
import dragon.nlp.tool.lemmatiser.EngLemmatiser;

public class StemmingPipe extends Pipe {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3953294740010701272L;

	private EngLemmatiser el = new EngLemmatiser("data/_DragonTool/nlpdata/lemmatiser", true, false);
	
	@Override
	public Instance pipe(Instance carrier) {
		if (carrier.getData() instanceof String) {
			String text = (String) carrier.getData();
			carrier.setData(el.lemmatize(text));
		} else {
			System.err.println("ERROR: input for StemmingPipe should be a String");
		}
		return carrier;
	}
	
	
}
